{% extends 'user/layout.html.twig' %}

{% block title %}{{ parent() }}{% endblock %}

{% set pageNav = 'favorited' %}

{% block main %}
  <div class="course-list course-list-new">
    <div class="row">
      {% for courseFavorite in courseFavorites if courseFavorite %}
        {% if courseFavorite.targetType == 'course' %}
          {% set courseSet = data('CourseSet',{ id: courseFavorite.targetId} ) %}
          <div class="col-lg-3 col-md-4 col-xs-6 course-item-wrap">
            {% include 'course/widgets/course-grid-new.html.twig' with { courseSet: courseSet } %}
          </div>
        {% elseif courseFavorite.targetType == 'openCourse' %}
          {% set course = data('OpenCourse',{courseId:courseFavorite.targetId})|default(null) %}
          {% if course %}
            <div class="col-lg-3 col-md-4 col-xs-6 course-item-wrap">
              {% include 'open-course/widget/open-course-grid.html.twig' %}
            </div>
          {% endif %}
        {% endif %}
        
      {% else %}
        <div class="empty">{{'user.homepage.favorite_courses.empty'|trans}}</div>
      {% endfor %}
    </div>
  </div>
  <nav class="text-center">
    {{ web_macro.paginator(paginator) }}
  </nav>
{% endblock %}